from flask import Flask, jsonify
import json

app = Flask(__name__)


@app.route('/film', methods=['GET'])
def film():
    with open('./film.json', 'rt', encoding='utf-8') as f:
        res = json.load(f)
    res = jsonify(res)
    res.headers['Access-Control-Allow-Origin'] = '*'
    return res


@app.route('/userinfo', methods=['GET'])
def userinfo():
    res = {'username': 'dujj', 'age': 25}
    res = jsonify(res)
    res.headers['Access-Control-Allow-Origin'] = '*'
    return res


if __name__ == '__main__':
    app.run(port=5000, debug=True)
